bitkeeper revision 1.1667 (42a0d723C0nVc96mE2UHsAZH4ZSJJA)
authordjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Fri, 3 Jun 2005 22:18:11 +0000 (22:18 +0000)
committerdjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>
Fri, 3 Jun 2005 22:18:11 +0000 (22:18 +0000)
Add EFI PCDP support to automatically find console
Signed-off-by: Dan Magenheimer <dan.magenheimer@hp.com>
.rootkeys
xen/arch/ia64/Makefile
xen/arch/ia64/pcdp.c [new file with mode: 0644]
xen/arch/ia64/tools/mkbuildtree
xen/arch/ia64/xensetup.c
xen/drivers/char/ns16550.c
xen/include/asm-ia64/config.h

index 81fc2bb5b5bff2b4dfc1a751befb084d32523c93..e8aeae1a954134271aff42f6e24d17c701f25baa 100644 (file)
--- a/.rootkeys
+++ b/.rootkeys
 421098b5DWbgK-tBR4um8PEAqPwqTA xen/arch/ia64/patch/linux-2.6.7/types.h
 421098b5il9YfZM0HpeCnaMgVN_q9g xen/arch/ia64/patch/linux-2.6.7/unaligned.c
 421098b65M5cPramsLGbODg8lQwUjQ xen/arch/ia64/patch/linux-2.6.7/wait.h
+42a0d69cCiNxr2Y1GY1khO7qRiNkbw xen/arch/ia64/pcdp.c
 421098b6cYDwzXP86ViTLlTO2x7ovA xen/arch/ia64/pdb-stub.c
 41a26ebcqaSGVQ8qTMwpPwOJSJ7qSw xen/arch/ia64/privop.c
 41a26ebc4BOHDUsT0TSnryPeV2xfRA xen/arch/ia64/process.c
index 3e997229b0bb6a464402ec04fb4931f28a9d69c8..d323f407c510d1c3883cb59682d1decec426b6b9 100644 (file)
@@ -4,7 +4,7 @@ include $(BASEDIR)/Rules.mk
 
 OBJS = xensetup.o setup.o time.o irq.o ia64_ksyms.o process.o smp.o \
        xenmisc.o pdb-stub.o acpi.o hypercall.o \
-       machvec.o dom0_ops.o domain.o hpsimserial.o \
+       machvec.o dom0_ops.o domain.o hpsimserial.o pcdp.o \
        idle0_task.o pal.o hpsim.o efi.o efi_stub.o ivt.o mm_contig.o \
        xenmem.o sal.o cmdline.o mm_init.o tlb.o smpboot.o \
        extable.o linuxextable.o xenirq.o xentime.o \
diff --git a/xen/arch/ia64/pcdp.c b/xen/arch/ia64/pcdp.c
new file mode 100644 (file)
index 0000000..e2ab84a
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Parse the EFI PCDP table to locate the console device.
+ *
+ * (c) Copyright 2002, 2003, 2004 Hewlett-Packard Development Company, L.P.
+ *     Khalid Aziz <khalid.aziz@hp.com>
+ *     Alex Williamson <alex.williamson@hp.com>
+ *     Bjorn Helgaas <bjorn.helgaas@hp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/acpi.h>
+#include <linux/console.h>
+#include <linux/efi.h>
+#include <linux/serial.h>
+#ifdef XEN
+#include <linux/errno.h>
+#endif
+#include "pcdp.h"
+
+static int __init
+setup_serial_console(struct pcdp_uart *uart)
+{
+#ifdef XEN
+       extern char opt_com1[1];
+       if (opt_com1[0]) return 0;
+       sprintf(&opt_com1[0], "0x%lx,%lu,%dn1",
+               uart->addr.address, uart->baud,
+               uart->bits ? uart->bits : 8);
+       return 0;
+#else
+#ifdef CONFIG_SERIAL_8250_CONSOLE
+       int mmio;
+       static char options[64];
+
+       mmio = (uart->addr.address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY);
+       snprintf(options, sizeof(options), "console=uart,%s,0x%lx,%lun%d",
+               mmio ? "mmio" : "io", uart->addr.address, uart->baud,
+               uart->bits ? uart->bits : 8);
+
+       return early_serial_console_init(options);
+#else
+       return -ENODEV;
+#endif
+#endif
+}
+
+#ifndef XEN
+static int __init
+setup_vga_console(struct pcdp_vga *vga)
+{
+#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
+       if (efi_mem_type(0xA0000) == EFI_CONVENTIONAL_MEMORY) {
+               printk(KERN_ERR "PCDP: VGA selected, but frame buffer is not MMIO!\n");
+               return -ENODEV;
+       }
+
+       conswitchp = &vga_con;
+       printk(KERN_INFO "PCDP: VGA console\n");
+       return 0;
+#else
+       return -ENODEV;
+#endif
+}
+#endif
+
+int __init
+efi_setup_pcdp_console(char *cmdline)
+{
+       struct pcdp *pcdp;
+       struct pcdp_uart *uart;
+       struct pcdp_device *dev, *end;
+       int i, serial = 0;
+
+       pcdp = efi.hcdp;
+       if (!pcdp)
+               return -ENODEV;
+
+#ifndef XEN
+       printk(KERN_INFO "PCDP: v%d at 0x%lx\n", pcdp->rev, __pa(pcdp));
+#endif
+
+       if (strstr(cmdline, "console=hcdp")) {
+               if (pcdp->rev < 3)
+                       serial = 1;
+       } else if (strstr(cmdline, "console=")) {
+#ifndef XEN
+               printk(KERN_INFO "Explicit \"console=\"; ignoring PCDP\n");
+#endif
+               return -ENODEV;
+       }
+
+       if (pcdp->rev < 3 && efi_uart_console_only())
+               serial = 1;
+
+       for (i = 0, uart = pcdp->uart; i < pcdp->num_uarts; i++, uart++) {
+               if (uart->flags & PCDP_UART_PRIMARY_CONSOLE || serial) {
+                       if (uart->type == PCDP_CONSOLE_UART) {
+                               return setup_serial_console(uart);
+                       }
+               }
+       }
+
+#ifndef XEN
+       end = (struct pcdp_device *) ((u8 *) pcdp + pcdp->length);
+       for (dev = (struct pcdp_device *) (pcdp->uart + pcdp->num_uarts);
+            dev < end;
+            dev = (struct pcdp_device *) ((u8 *) dev + dev->length)) {
+               if (dev->flags & PCDP_PRIMARY_CONSOLE) {
+                       if (dev->type == PCDP_CONSOLE_VGA) {
+                               return setup_vga_console((struct pcdp_vga *) dev);
+                       }
+               }
+       }
+#endif
+
+       return -ENODEV;
+}
index c88b9841b99bba222f523eb7ced0468f8626feb3..e1d373f545ce86c43bbb1cabcea5874e5adefa27 100644 (file)
@@ -309,6 +309,8 @@ softlink include/linux/topology.h include/asm-ia64/linux/topology.h
 softlink include/linux/seqlock.h include/asm-ia64/linux/seqlock.h
 softlink include/linux/jiffies.h include/asm-ia64/linux/jiffies.h
 
+softlink drivers/firmware/pcdp.h arch/ia64/pcdp.h
+
 null include/asm-ia64/linux/file.h
 null include/asm-ia64/linux/module.h
 null include/asm-ia64/linux/swap.h
index 162fe145e9d09b5ceb668eb922e2c7fbca425d87..413cf66b8983b97567ae76318e4d84dd5667194a 100644 (file)
@@ -107,12 +107,15 @@ static void __init do_initcalls(void)
  *     "com2=57600,8n1 console=com2 -- console=ttyS1 console=tty
  * root=/dev/sda3 ro"
  */
+static char null[4] = { 0 };
+
 void early_cmdline_parse(char **cmdline_p)
 {
     char *guest_cmd;
     char *split = "--";
 
     if (*cmdline_p == NULL) {
+       *cmdline_p = &null[0];
        saved_command_line[0] = '\0';
        return;
     }
@@ -121,7 +124,7 @@ void early_cmdline_parse(char **cmdline_p)
     /* If no spliter, whole line is for guest */
     if (guest_cmd == NULL) {
        guest_cmd = *cmdline_p;
-       *cmdline_p = NULL;
+       *cmdline_p = &null[0];
     } else {
        *guest_cmd = '\0';      /* Split boot parameters for xen and guest */
        guest_cmd += strlen(split);
index 3a58e347670ab16a6458762c85c81e3e45d6fc75..ea094c843cb0313e4852379866b5eeee268a9cc7 100644 (file)
@@ -16,7 +16,7 @@
 #include <asm/io.h>
 
 /* Config serial port with a string <baud>,DPS,<io-base>,<irq>. */
-static char opt_com1[30] = "", opt_com2[30] = "";
+char opt_com1[30] = "", opt_com2[30] = "";
 string_param("com1", opt_com1);
 string_param("com2", opt_com2);
 
index c419adf8be96f424d75b4aacb9974b6b13286148..f0e556f69bc92ddd07e9df6e2bb296c481eb4a0c 100644 (file)
@@ -18,6 +18,8 @@
 #define        CONFIG_IA64_PAGE_SIZE_16KB      // 4KB doesn't work?!?
 #define        CONFIG_IA64_GRANULE_16MB
 
+#define CONFIG_EFI_PCDP
+
 #ifndef __ASSEMBLY__
 
 // can't find where this typedef was before?!?